% 手动定义第一条线的坐标
iterations1 = [1, 40, 80, 120, 160, 200, 240, 280, 320, 360, ...
               400, 440, 480, 520, 560, 600, 640, 680, 720, 760, ...
               800, 840, 880, 920, 960, 1000];
average_access_rates1 =  [0.41,0.40,0.413,0.41,0.42,0.43,0.41,0.43,0.44,0.445,...,
  0.467,0.47,0.475,0.479,0.492,0.497,0.5,0.50235,0.51230,0.5226,...
  0.52,0.526,0.5221,0.524,0.524,0.5220];

% 手动定义第二条线的坐标
iterations2 = iterations1; % 使用相同的迭代次数
average_access_rates2 = [0.4225,0.43,0.433,0.4231,0.4128,0.37423,0.3215,0.3085,0.29166,0.27155,...,
  0.22155,0.22155,0.20152,0.1715,0.0911148,0.0911146,0.091146,0.09143,0.07146,0.02147,...
  0.0243,0.02147,0.01143,0.01147,0.01146,0.01147];
 
% 手动定义第三条线的坐标
iterations3 = iterations1; % 使用相同的迭代次数
average_access_rates3 = [0.364195,0.37419,0.384193,0.364192,0.36695,0.37185,0.299184,0.23182,0.1646,0.1035,...,
  0.08155,0.08135,0.08152,0.08154,0.08128,0.05146,0.07126,0.076125,0.077122,0.02127,...
  0.02123,0.02127,0.01123,0.01127,0.0123,0.0124];
 
% 绘制图形
figure;
plot(iterations1, average_access_rates1, '-o','LineWidth', 2,  'DisplayName', 'DQN');
hold on; % 保持当前图形
plot(iterations2, average_access_rates2, '-s', 'LineWidth', 2,'DisplayName', 'D3QN');
plot(iterations3, average_access_rates3, '-d','LineWidth', 2,  'DisplayName', 'FL-D3QN');
hold off;
 
% 添加标签和图例
xlabel('迭代次数');
ylabel('与SU的平均碰撞概率');


legend('show'); % 显示图例